package com.picket.domain;

import java.util.Date;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Match {

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Key key;

	@NotNull
	@Persistent
	private Integer matchNo;

	@NotNull
	@Size(min = 1, max = 25)
	@Persistent
	private String matchLocation;

	@NotNull
	@Persistent
	private Long eventId;

	public Match(Integer matchNo, String matchLocation, Long eventId,
			Date matchDateTime, String matchOpponent1,
			Integer matchOpponentPts1, String matchOpponent2,
			Integer matchOpponentPts2, Integer matchTiePts,
			Integer matchNoResultPts, String updateUserId) {
		super();
		this.matchNo = matchNo;
		this.matchLocation = matchLocation;
		this.eventId = eventId;
		this.matchDateTime = matchDateTime;
		this.matchOpponent1 = matchOpponent1;
		this.matchOpponentPts1 = matchOpponentPts1;
		this.matchOpponent2 = matchOpponent2;
		this.matchOpponentPts2 = matchOpponentPts2;
		this.matchTiePts = matchTiePts;
		this.matchNoResultPts = matchNoResultPts;
		this.updateUserId = updateUserId;
	}

	@NotNull
	@Persistent
	private Date matchDateTime;

	@Size(min = 1, max = 5)
	@Persistent
	private String matchOpponent1;
	@Persistent
	private Integer matchOpponentPts1;
	@Size(min = 1, max = 5)
	@Persistent
	private String matchOpponent2;
	@NotNull
	@Persistent
	private Integer matchOpponentPts2;
	@NotNull
	@Persistent
	private Integer matchTiePts;
	@NotNull
	@Persistent
	private Integer matchNoResultPts;
	@Size(min = 1, max = 5)
	@Persistent
	private String matchOutcome;
	@Persistent
	private Integer matchOutcomePts;
	@Size(min = 1, max = 45)
	@Persistent
	private String updateUserId;

	public Key getKey() {
		return key;
	}

	public Long getId() {
		return key.getId();
	}

	public Integer getMatchNo() {
		return matchNo;
	}

	public void setMatchNo(Integer matchNo) {
		this.matchNo = matchNo;
	}

	public String getMatchLocation() {
		return matchLocation;
	}

	public void setMatchLocation(String matchLocation) {
		this.matchLocation = matchLocation;
	}

	public Long getEventId() {
		return eventId;
	}

	public void setEventId(Long eventId) {
		this.eventId = eventId;
	}

	public Date getMatchDateTime() {
		return matchDateTime;
	}

	public void setMatchDateTime(Date matchDateTime) {
		this.matchDateTime = matchDateTime;
	}

	public String getMatchOpponent1() {
		return matchOpponent1;
	}

	public void setMatchOpponent1(String matchOpponent1) {
		this.matchOpponent1 = matchOpponent1;
	}

	public Integer getMatchOpponentPts1() {
		return matchOpponentPts1;
	}

	public void setMatchOpponentPts1(Integer matchOpponentPts1) {
		this.matchOpponentPts1 = matchOpponentPts1;
	}

	public String getMatchOpponent2() {
		return matchOpponent2;
	}

	public void setMatchOpponent2(String matchOpponent2) {
		this.matchOpponent2 = matchOpponent2;
	}

	public Integer getMatchOpponentPts2() {
		return matchOpponentPts2;
	}

	public void setMatchOpponentPts2(Integer matchOpponentPts2) {
		this.matchOpponentPts2 = matchOpponentPts2;
	}

	public Integer getMatchTiePts() {
		return matchTiePts;
	}

	public void setMatchTiePts(Integer matchTiePts) {
		this.matchTiePts = matchTiePts;
	}

	public Integer getMatchNoResultPts() {
		return matchNoResultPts;
	}

	public void setMatchNoResultPts(Integer matchNoResultPts) {
		this.matchNoResultPts = matchNoResultPts;
	}

	public String getMatchOutcome() {
		return matchOutcome;
	}

	public void setMatchOutcome(String matchOutcome) {
		this.matchOutcome = matchOutcome;
	}

	public Integer getMatchOutcomePts() {
		return matchOutcomePts;
	}

	public void setMatchOutcomePts(Integer matchOutcomePts) {
		this.matchOutcomePts = matchOutcomePts;
	}

	public String getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(String updateUserId) {
		this.updateUserId = updateUserId;
	}
	
	public String getSummary() {
		return matchOpponent1 + " - " + matchOpponent2;
	}	


	
}